<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>修改节点</title>
</head>
<body>
<p id="p1">welcome to beijing</p>
<script type="text/javascript">
    var textNode = document.getElementById('p1').firstChild;
</script>
<form action="#" method="get">
    <input  type="button" value="显示" onclick="alert(textNode.data);">
    <input  type="button" value="长度" onclick="alert(textNode.length);">
    <input  type="button" value="改变" onclick="textNode.data='nice to meet you!'"><p></p>
    <input  type="button" value="追加" onclick="textNode.appendData(' too');">
    <input  type="button" value="插入" onclick="textNode.insertData(0,'very');">
    <input  type="button" value="delete" onclick="textNode.deleteData(0,2);"><p></p>
    <input  type="button" value="replace" onclick="textNode.replaceData(0,4,'tel');">
    <input  type="button" value="子串" onclick="alert(textNode.substringData(2,2));">
    <input  type="button" value="拆分" onclick="temp = textNode.splitText(5);alert('Text node='+textNode.data+'\nSpilt Value='+temp.data)">
</form>
</body>
</html>